import requests

url = "http://192.168.0.13:4865/seeyon/rest/token/rest/0fc50a35-d68a-4e7d-b24c-6d1a5efc4ee2"
response = requests.get(url) # 发起请求
try:
    ZYtoken = response.json()['id']
except:
    ZYtoken = response.text



def getzytoken():
    git_url = "http://192.168.0.13:4865/seeyon/rest/token/rest/0fc50a35-d68a-4e7d-b24c-6d1a5efc4ee2"
    header = {
        "Accept": "application/json",
        "Content-Type": "application/json"
    }
    r = requests.get(url=git_url, headers=header)
    gettoken = r.json()['id']
    return gettoken


# 当前用户
def shen_header():
    shen_url = 'http://192.168.0.13:4865/seeyon/rest/token/rest/0fc50a35-d68a-4e7d-b24c-6d1a5efc4ee2?loginName=djnode'
    header = {
        "Accept": "application/json",
        "Content-Type": "application/json;charset=UTF-8"
    }
    token = requests.get(url=shen_url, headers=header)
    header_shen = {
        "token": token.json()['id']
    }
    return header_shen

if __name__ == '__main__':
    # print(getzytoken())
    print(shen_header())